
#include <math.h>


typedef struct {
  double g_x;
  double g_y;
} Metric;


int _init_metric_wcs(Metric *m, double x0, double y0) {

  double theta = y0/180.*3.1415926;

  m->g_x = cos(theta);
  m->g_y = 1.;

}


double metric_distance2(Metric *m, double x1, double y1, double x2, double y2) {
  double dx = (x2-x1)*(m->g_x);
  double dy = (y2-y1)*(m->g_y);

  return (dx*dx + dy*dy);
}



typedef struct {
  int (*init_metric)(Metric *m, double x0, double y0);
} RegionContext;


RegionContext metric_wcs = {_init_metric_wcs};
